<?php
// PDO connect *********
include_once ('../connexpdo.php');

$pdo = $connexion;
$keyword = '%' . strtoupper ( $_POST ['keyword'] ) . '%';
$sql = "SELECT * FROM praticiens WHERE nom LIKE (:keyword) ORDER BY nom ASC LIMIT 0, 10";
$query = $pdo->prepare ( $sql );
$query->bindParam ( ':keyword', $keyword, PDO::PARAM_STR );
$query->execute ();
$list = $query->fetchAll ();
foreach ( $list as $rs ) {
	// put in bold the written text
	$nom = str_replace ( $_POST ['keyword'], $_POST ['keyword'], $rs ['nom'] );
	$prenom = str_replace ( $_POST ['keyword'], $_POST ['keyword'], $rs ['prenom'] );
	// add new option
	echo '<li value="' . $rs ['id'] . '" name="clients" onclick="set_item(this)">' . $nom . ' ' . $prenom . "</li>";
}
?>